<include file="application/walletyhbbadmin/view/public/left.html"/>
<div id="dcMain">
    <!-- 当前位置 -->
    <div id="urHere">管理中心<b>></b><strong>首页信息</strong> </div>
    <div class="mainBox" style="height:auto!important;height:550px;min-height:550px;">


        <div id="list">
            <h3>添加产品</h3><br/>
            <div class="content" style="padding-left: 100px;">
                <form action="{:U('doadd')}" method="post" enctype="multipart/form-data">
                    <input type="hidden" name="id" value="{$res.w_id}">
                    名&nbsp;&nbsp;称(中): &nbsp;<input type="text" name="name" value="" style="border: 1px solid #CCCCCC; height: 30px;width: 300px;"><br/><br/>
                    名&nbsp;&nbsp;称(英): &nbsp;<input type="text" name="uname" value="" style="border: 1px solid #CCCCCC; height: 30px;width: 300px;"><br/><br/>
                    名&nbsp;&nbsp;称(日): &nbsp;<input type="text" name="jname" value="" style="border: 1px solid #CCCCCC; height: 30px;width: 300px;"><br/><br/>
                    图&nbsp;&nbsp;片:&nbsp; <input type="file" name="pic" value="">推荐上传440px * 440px的图片<br/><br/>
<!--                    <td align="right">商品分类: </td>-->
<!--                    <td colspan="3">-->
<!--                        <div class="form-group">-->
<!--                            <select id="tid" name="belong_1"  required>-->
<!--                                <option value="" class="ss">&#45;&#45;请选择&#45;&#45;</option>-->
<!--                                <foreach name="list" item="vo">-->
<!--                                    <option value="{$vo.id}" class="ioo">{$vo.name}</option>-->
<!--                                </foreach>-->
<!--                            </select>-->
<!--                            <select id="tid1" style="display:none;" name="belong_2">-->
<!--                                <option value="" class="ss">&#45;&#45;请选择&#45;&#45;</option>-->
<!--                            </select>-->

<!--                        </div>-->
<!--                    </td>-->
                    类&nbsp;&nbsp;型:&nbsp;
                    <select name="xuan" id="tid">
                        <option value="" class="ss">--请选择--</option>
                        <foreach name="list" item="vc">
                            <option value="{$vc.id}">{$vc.name}</option>
                        </foreach>
                    </select>
                    <select id="tid1" style="display:none;" name="fenlei">
                        <option value="" class="ss">--请选择--</option>
                    </select>
                    <span></span>
                    <script src="http://libs.baidu.com/jquery/1.7.2/jquery.min.js"></script>

                    <br/><br/>
<!--                    商品简介: <textarea name="jianjie" id="jianjie" cols="100" rows="10" style="border: 1px solid #CCCCCC;"></textarea><br/><br/>-->
                    <tr>
                        <td align="right" valign="top">商品简介(中)：</td>
                        <td>
                            <!-- KindEditor -->
                            <link rel="stylesheet" href="__PUBLIC__/app/admin/js/kindeditor/themes/default/default.css" />
                            <link rel="stylesheet" href="__PUBLIC__/app/admin/js/kindeditor/plugins/code/prettify.css" />
                            <script charset="utf-8" src="__PUBLIC__/app/admin/js/kindeditor/kindeditor.js"></script>
                            <script charset="utf-8" src="__PUBLIC__/app/admin/js/kindeditor/lang/zh_CN.js"></script>
                            <script charset="utf-8" src="__PUBLIC__/app/admin/js/kindeditor/plugins/code/prettify.js"></script>
                            <script>
                                KindEditor.ready(function(K) {
                                    var editor1 = K.create('textarea[name="content"]', {
                                        cssPath : '../plugins/code/prettify.css',
                                        uploadJson : '../php/upload_json.php',
                                        fileManagerJson : '../php/file_manager_json.php',
                                        allowFileManager : true,
                                        afterCreate : function() {
                                            var self = this;
                                            K.ctrl(document, 13, function() {
                                                self.sync();
                                                K('form[name=example]')[0].submit();
                                            });
                                            K.ctrl(self.edit.doc, 13, function() {
                                                self.sync();
                                                K('form[name=example]')[0].submit();
                                            });
                                        }
                                    });
                                    prettyPrint();
                                });
                            </script>
                            <!-- /KindEditor -->
                            <textarea id="content" name="content" style="width:780px;height:400px;" class="textArea">{$res.ct_jianjie}</textarea>
                        </td>
                    </tr>
                    <tr>
                        <td align="right" valign="top">商品简介(英)：</td>
                        <td>
                            <!-- KindEditor -->
                            <link rel="stylesheet" href="__PUBLIC__/app/admin/js/kindeditor/themes/default/default.css" />
                            <link rel="stylesheet" href="__PUBLIC__/app/admin/js/kindeditor/plugins/code/prettify.css" />
                            <script charset="utf-8" src="__PUBLIC__/app/admin/js/kindeditor/kindeditor.js"></script>
                            <script charset="utf-8" src="__PUBLIC__/app/admin/js/kindeditor/lang/zh_CN.js"></script>
                            <script charset="utf-8" src="__PUBLIC__/app/admin/js/kindeditor/plugins/code/prettify.js"></script>
                            <script>
                                KindEditor.ready(function(K) {
                                    var editor1 = K.create('textarea[name="ucontent"]', {
                                        cssPath : '../plugins/code/prettify.css',
                                        uploadJson : '../php/upload_json.php',
                                        fileManagerJson : '../php/file_manager_json.php',
                                        allowFileManager : true,
                                        afterCreate : function() {
                                            var self = this;
                                            K.ctrl(document, 13, function() {
                                                self.sync();
                                                K('form[name=example]')[0].submit();
                                            });
                                            K.ctrl(self.edit.doc, 13, function() {
                                                self.sync();
                                                K('form[name=example]')[0].submit();
                                            });
                                        }
                                    });
                                    prettyPrint();
                                });
                            </script>
                            <!-- /KindEditor -->
                            <textarea id="ucontent" name="ucontent" style="width:780px;height:400px;" class="textArea">{$res.ct_jianjie}</textarea>
                        </td>
                    </tr>
                    <tr>
                        <td align="right" valign="top">商品简介(日)：</td>
                        <td>
                            <!-- KindEditor -->
                            <link rel="stylesheet" href="__PUBLIC__/app/admin/js/kindeditor/themes/default/default.css" />
                            <link rel="stylesheet" href="__PUBLIC__/app/admin/js/kindeditor/plugins/code/prettify.css" />
                            <script charset="utf-8" src="__PUBLIC__/app/admin/js/kindeditor/kindeditor.js"></script>
                            <script charset="utf-8" src="__PUBLIC__/app/admin/js/kindeditor/lang/zh_CN.js"></script>
                            <script charset="utf-8" src="__PUBLIC__/app/admin/js/kindeditor/plugins/code/prettify.js"></script>
                            <script>
                                KindEditor.ready(function(K) {
                                    var editor1 = K.create('textarea[name="jcontent"]', {
                                        cssPath : '../plugins/code/prettify.css',
                                        uploadJson : '../php/upload_json.php',
                                        fileManagerJson : '../php/file_manager_json.php',
                                        allowFileManager : true,
                                        afterCreate : function() {
                                            var self = this;
                                            K.ctrl(document, 13, function() {
                                                self.sync();
                                                K('form[name=example]')[0].submit();
                                            });
                                            K.ctrl(self.edit.doc, 13, function() {
                                                self.sync();
                                                K('form[name=example]')[0].submit();
                                            });
                                        }
                                    });
                                    prettyPrint();
                                });
                            </script>
                            <!-- /KindEditor -->
                            <textarea id="jcontent" name="jcontent" style="width:780px;height:400px;" class="textArea">{$res.ct_jianjie}</textarea>
                        </td>
                    </tr>
                    <tr>
                        <td align="right" valign="top">是否在首页显示：</td>
                        <td>
                                <input type="radio" value="1" name="status"  checked="checked"/>是
                                <input type="radio" value="0" name="status"  />否
                        </td>
                    </tr>
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <input name="submit" class="btn" type="submit" value="提交" />
<!--                            <button class="layui-btn layui-btn-small layui-btn-normal" lay-submit  lay-filter="sub">确认保存</button>-->
<!--                            <button class="layui-btn layui-btn-small layui-btn-primary" id="back">返回操作</button>-->
                        </div>
                    </div>
                </form>
            </div>
        </div>

    </div>
</div>
<div class="clear"></div>
<include file="application/walletyhbbadmin/view/public/foot.html"/><!-- dcFooter 结束 -->
<div class="clear"></div> </div>
<script type="text/javascript">

    onload = function()
    {
        document.forms['action'].reset();
    }

    function douAction()
    {
        var frm = document.forms['action'];
        frm.elements['new_cat_id'].style.display = frm.elements['action'].value == 'category_move' ? '' : 'none';
    }

    function shanchu(id) {
        var url = "{:U('Member/delete')}";
        var msg = "您确定要删除吗？";
        if (confirm(msg)==true){
            $.post(url, {'member_id': id}, function (data) {
                layer.msg(data.info);
                if (data.status == 1) {
                    setTimeout(function () {
                        window.location.reload();
                    }, 2000);
                }
            });
        }
    }

    function shanchu(id){
        var url="{:U('Member/delete')}";
        var msg = "您确定要删除吗？";
        if (confirm(msg)==true) {
            $.post(url, {'member_id': id}, function (data) {
                layer.msg(data.info);
                if (data.status == 1) {
                    setTimeout(function () {
                        window.location.reload();
                    }, 2000);
                }
            });
        }
    }


</script>
<script type="application/javascript">
    $(document).ready(function(){
        $("#select1").change(function(){
            var fid = $(this).val();
            console.log(fid);
            // console.log(fid);
            $.ajax({
                'url':'{:U("finance/doadd")}',//请求的url
                'type':'get',//请求类型
                'data':{parentId:fid},//附加参数
                'async':true,//异步处理
                'dataType':'json',//响应数据返回类型
                success:
                //data 响应数据
                    function(data){
                        $("#tid1 option").remove();//清除
                        // console.log(data);//f12打印
                        var option = '<option value="-1">--请选择--</option>';
                        // //遍历
                        for(var i=0;i<data.length;i++){
                            //禁用
                            // $(".ss").attr("disabled",true);
                            //alert(data[i].name);
                            //把获取的数据存储在option标签里
                            option +='<option value="'+data[i].id+'">'+data[i].mobile_name+'</option>';
                            // alert(option);
                        }
                        //内部插入到第一个select
                        $("#tid1").append(option);
                        $("#tid1").css('display',"inline-block");
                    },
                error:
                    function () {
                        alert("Ajax响应失败");
                    }
            });
        });
    });
</script>
<script>
    $(document).ready(function(){
        $("#tid").change(function(){
            var fid = $(this).val();
            // console.log(fid);
            $.ajax({
                'url':'{:U("Finance/xuanzeType")}',//请求的url
                'type':'get',//请求类型
                'data':{parentId:fid},//附加参数
                'async':true,//异步处理
                'dataType':'json',//响应数据返回类型
                success:
                //data 响应数据
                    function(data){
                        $("#tid1 option").remove();//清除
                        console.log(data);//f12打印
                        var option = '<option value="">--请选择--</option>';
                        // //遍历
                        for(var i=0;i<data.length;i++){
                            //禁用
                            // $(".ss").attr("disabled",true);
                            //alert(data[i].name);
                            //把获取的数据存储在option标签里
                            option +='<option value="'+data[i].id+'">'+data[i].name+'</option>';
                            // alert(option);
                        }
                        //内部插入到第一个select
                        $("#tid1").append(option);
                        $("#tid1").css('display',"inline-block");
                    },
                error:
                    function () {
                        alert("Ajax响应失败");
                    }
            });
        });

    });
</script>
<!--<script>-->
<!--    $(document).ready(function(){-->

<!--        $("#yy").change(function(){-->
<!--            var fid = $(this).val();-->
<!--            // console.log(fid);-->

<!--            $.ajax({-->
<!--                'url':'{:U("Goods/addType1")}',//请求的url-->
<!--                'type':'get',//请求类型-->
<!--                'data':{parentId:fid},//附加参数-->
<!--                'async':true,//异步处理-->
<!--                'dataType':'json',//响应数据返回类型-->
<!--                success:-->
<!--                //data 响应数据-->

<!--                    function(data){-->
<!--                        $("#yy1 option").remove();//清除-->
<!--                        console.log(data);//f12打印-->
<!--                        var option = '<option value="">&#45;&#45;请选择&#45;&#45;</option>';-->
<!--                        // //遍历-->
<!--                        for(var i=0;i<data.length;i++){-->
<!--                            //禁用-->
<!--                            // $(".ss").attr("disabled",true);-->
<!--                            //alert(data[i].name);-->
<!--                            //把获取的数据存储在option标签里-->
<!--                            option +='<option value="'+data[i].id+'">'+data[i].name+'</option>';-->
<!--                            // alert(option);-->
<!--                        }-->
<!--                        //内部插入到第一个select-->
<!--                        $("#yy1").append(option);-->
<!--                        $("#yy1").css('display',"inline-block");-->
<!--                    },-->
<!--                error:-->
<!--                    function () {-->
<!--                        alert("Ajax响应失败");-->
<!--                    }-->
<!--            });-->
<!--        });-->

<!--    });-->

<!--</script>-->

</body>
</html>
